package com.sugon.entity.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 树节点VO类，目前主要适用于小程序端的bl-picker
 *
 * @author YuXD
 * @since 2021-12-30
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Data
public class TreeNode implements Serializable {

    private String label;

    private String value;

    @JsonIgnore
    private String pid;

    @JsonIgnore
    private String hasChild;

    private List<TreeNode> children;

    public TreeNode() {
        children = new ArrayList<>();
    }

    public TreeNode(String label, String value) {
        this.label = label;
        this.value = value;
        this.children = new ArrayList<>();
    }

    public TreeNode(String label, String value, String pid, String hasChild) {
        this.label = label;
        this.value = value;
        this.pid = pid;
        this.hasChild = hasChild;
        this.children = new ArrayList<>();
    }
}
